<template>
  <div class="system-role-container layout-padding">
    <div
      style="border: none"
      class="system-role-padding layout-padding-auto layout-padding-view"
    >
      <el-tabs v-model="activeName" type="border-card">
        <el-tab-pane
          label="日压力容器设计质量安全检查"
          name="日压力容器设计质量安全检查"
        >
          <div style="margin: 0 300px">
            <div v-if="false">
              <div class="BT_title">每日压力容器设计质量安全检查记录表11</div>
              <el-form style="margin-bottom: 10px" label-position="left">
                <!-- <el-form-item label="文件编号:" label-width="200px">
                <el-input
                  style="width: 90%"
                  v-model="table1.file_no"
                  placeholder="请输入编号"
                />
              </el-form-item> -->
                <el-form-item label="安全检查日期:" label-width="200px">
                  <el-date-picker
                    @change="changeTime1"
                    v-model="table1.check_time"
                    value-format="YYYY-MM-DD"
                    type="date"
                    placeholder="请选择日期"
                    size="default"
                  />
                </el-form-item>
                <el-form-item label="检查文件号:" label-width="200px">
                  <el-input
                    style="width: 90%"
                    resize="none"
                    :rows="3"
                    type="textarea"
                    v-model="table1.check_file_nos"
                    placeholder="请填写检查文件号"
                  />
                </el-form-item>
                <el-form-item label="采取的防范措施:" label-width="200px">
                  <el-input
                    style="width: 90%"
                    resize="none"
                    :rows="3"
                    type="textarea"
                    v-model="table1.precautions"
                    placeholder="请填写采取的防范措施"
                  />
                </el-form-item>
              </el-form>

              <el-table
                size="default"
                :header-cell-style="{
                  background: '#fafbfc',
                  color: '#333333',
                }"
                :height="activeHeight"
                :data="table1.tableData"
                style="width: 100%"
              >
                <el-table-column width="80" label="序号" type="index" />
                <el-table-column width="250" prop="title" label="检查项目" />
                <el-table-column
                  width="180"
                  prop="check_item_result"
                  label="检查结果"
                >
                  <template #default="scope">
                    <el-input
                      style="width: 90%"
                      v-model="scope.row.check_item_result"
                      placeholder="请输入检查结果"
                    >
                    </el-input>
                  </template>
                </el-table-column>
                <el-table-column
                  width="180"
                  prop="processing_item_result"
                  label="处理结果"
                >
                  <template #default="scope">
                    <el-input
                      style="width: 90%"
                      v-model="scope.row.processing_item_result"
                      placeholder="请输入处理结果"
                    >
                    </el-input>
                  </template>
                </el-table-column>
                <el-table-column
                  width="130"
                  prop="quality_safety_officer"
                  label="质量安全员"
                >
                  <template #default="scope">
                    <el-input
                      style="width: 90%"
                      v-model="scope.row.quality_safety_officer"
                      placeholder="请输入质量安全员"
                    >
                    </el-input>
                  </template>
                </el-table-column>
                <el-table-column
                  width="180"
                  prop="check_item_note"
                  label="备注"
                >
                  <template #default="scope">
                    <el-input
                      style="width: 100%"
                      v-model="scope.row.check_item_note"
                      placeholder="请输入备注"
                    >
                    </el-input>
                  </template>
                </el-table-column>
              </el-table>
            </div>
            <el-scrollbar :height="activeHeight_Scroll">
              <table
                style="line-height: 20px"
                class="my_table"
                border="2px"
                width="100%"
              >
                <tr>
                  <td
                    rowspan="2"
                    colspan="3"
                    style="
                      text-align: center;
                      font-size: 16px;
                      font-weight: bold;
                    "
                  >
                    <img
                      style="width: 240px"
                      src=""
                    />
                  </td>
                  <td
                    rowspan="2"
                    colspan="2"
                    style="
                      text-align: center;
                      font-size: 22px;
                      line-height: 27px;
                      width: 249px;
                      font-weight: bold;
                    "
                  >
                    每日压力容器设计<br />
                    质量安全检查记录表
                  </td>
                  <td
                    style="
                      text-align: center;
                      font-size: 16px;
                      font-weight: bold;
                    "
                  >
                    编 &nbsp;&nbsp; 号
                  </td>
                  <td
                    style="
                      text-align: center;
                      font-size: 14px;
                      font-weight: bold;
                      color: #ccc;
                    "
                  >
                    自动生成
                  </td>
                </tr>

                <tr>
                  <td
                    style="
                      text-align: center;
                      font-size: 16px;
                      font-weight: bold;
                    "
                  >
                    日 &nbsp;&nbsp; 期
                  </td>
                  <td
                    style="
                      text-align: center;
                      font-size: 16px;
                      font-weight: bold;
                    "
                  >
                    <el-date-picker
                      style="width: 80%"
                      size="small"
                      @change="changeTime1"
                      v-model="table1.check_time"
                      value-format="YYYY-MM-DD"
                      type="date"
                      placeholder="请选择日期"
                    />
                  </td>
                </tr>

                <tr>
                  <td
                    colspan="7"
                    style="text-align: left; font-size: 14px; font-weight: bold"
                  >
                    检查文件号：
                    <div style="margin-top: 10px; margin-bottom: 10px">
                      <el-input
                        style="width: 100%"
                        resize="none"
                        :rows="3"
                        type="textarea"
                        v-model="table1.check_file_nos"
                        placeholder="请填写检查文件号"
                      />
                    </div>
                  </td>
                </tr>

                <tr>
                  <td
                    style="
                      text-align: center;
                      font-size: 14px;
                      font-weight: bold;
                      width: 82px;
                    "
                  >
                    序号
                  </td>
                  <td
                    colspan="2"
                    style="
                      text-align: center;
                      font-size: 14px;
                      font-weight: bold;
                      width: 300px;
                    "
                  >
                    检查项目
                  </td>
                  <td
                    style="
                      text-align: center;
                      font-size: 14px;
                      font-weight: bold;
                    "
                  >
                    检查结果
                  </td>
                  <td
                    style="
                      text-align: center;
                      font-size: 14px;
                      font-weight: bold;
                    "
                  >
                    处理结果
                  </td>
                  <td
                    style="
                      text-align: center;
                      font-size: 14px;
                      font-weight: bold;
                    "
                  >
                    质量安全员
                  </td>
                  <td
                    style="
                      text-align: center;
                      font-size: 14px;
                      font-weight: bold;
                    "
                  >
                    备注
                  </td>
                </tr>
                <tbody v-for="(item, index) in table1.tableData" :key="index">
                  <tr>
                    <td style="text-align: center; font-size: 14px">
                      {{ index + +1 }}
                    </td>
                    <td
                      colspan="2"
                      style="text-align: left; font-size: 14px; width: 300px"
                    >
                      {{ item.title }}
                    </td>
                    <td style="text-align: center; font-size: 14px">
                      <el-input
                        size="small"
                        resize="none"
                        :rows="2"
                        type="textarea"
                        style="width: 100%"
                        v-model="item.check_item_result"
                        placeholder="请输入检查结果"
                      >
                      </el-input>
                    </td>
                    <td style="text-align: center; font-size: 14px">
                      <el-input
                        size="small"
                        resize="none"
                        :rows="2"
                        type="textarea"
                        style="width: 100%"
                        v-model="item.processing_item_result"
                        placeholder="请输入处理结果"
                      >
                      </el-input>
                    </td>
                    <td style="text-align: center; font-size: 14px">
                      <el-input
                        size="small"
                        resize="none"
                        :rows="2"
                        type="textarea"
                        style="width: 100%"
                        v-model="item.quality_safety_officer"
                        placeholder="请输入质量安全员"
                      >
                      </el-input>
                    </td>
                    <td style="text-align: center; font-size: 14px">
                      <el-input
                        size="small"
                        resize="none"
                        :rows="2"
                        type="textarea"
                        style="width: 100%"
                        v-model="item.check_item_note"
                        placeholder="输入备注"
                      >
                      </el-input>
                    </td>
                  </tr>
                </tbody>
                <tr>
                  <td
                    colspan="7"
                    style="text-align: left; font-size: 14px; font-weight: bold"
                  >
                    采取的防范措施：
                    <div style="margin-top: 10px; margin-bottom: 10px">
                      <el-input
                        style="width: 100%"
                        resize="none"
                        :rows="5"
                        type="textarea"
                        v-model="table1.precautions"
                        placeholder="请填写采取的防范措施"
                      />
                    </div>
                  </td>
                </tr>
              </table>
            </el-scrollbar>

            <div style="height: 5px"></div>
            <div style="display: flex; justify-content: flex-end">
              <el-button @click="saveTable1" type="primary" size="small"
                >保存表格</el-button
              >
            </div>
          </div>
        </el-tab-pane>
        <el-tab-pane
          label="周压力容器设计质量安全排查治理报告 "
          name="压力容器设计质量安全排查治理报告"
        >
          <div style="margin: 0 300px">
            <div v-if="false">
              <div class="BT_title">每周压力容器设计质量安全排查治理报告</div>
              <el-form style="margin-bottom: 10px" label-position="left">
                <!-- <el-form-item label-width="220px" label="文件编号：">
                <el-input
                  style="width: 90%"
                  v-model="table2.file_no"
                  placeholder="请输入编号"
                />
              </el-form-item> -->
                <el-form-item label="治理报告日期:" label-width="220px">
                  <el-date-picker
                    v-model="table2.report_time"
                    value-format="YYYY-MM-DD"
                    type="date"
                    placeholder="请选择日期"
                    size="default"
                  />
                </el-form-item>
                <el-form-item
                  label-width="220px"
                  label="上周特种设备（压力容器）设计质量安全风险隐患问题整改核实情况："
                >
                  <el-input
                    style="width: 90%"
                    resize="none"
                    :rows="4"
                    type="textarea"
                    v-model="table2.item1_value"
                    placeholder="请输入"
                  />
                </el-form-item>

                <el-form-item
                  label-width="220px"
                  label="本周特种设备（压力容器）设计主要质量安全风险隐患和整改情况："
                >
                  <el-input
                    style="width: 90%"
                    resize="none"
                    :rows="4"
                    type="textarea"
                    v-model="table2.item2_value"
                    placeholder="请输入"
                  />
                </el-form-item>

                <el-form-item
                  label-width="220px"
                  label="本周特种设备（压力容器）设计质量安全管理情况评价："
                >
                  <el-radio-group
                    style="width: 90%"
                    v-model="table2.item3_value"
                    class="ml-4"
                  >
                    <el-radio :label="true" size="default"
                      >质量安全风险可控，无较大质量安全风险隐患</el-radio
                    >
                    <el-radio :label="false" size="default"
                      >存在质量安全风险隐患，需尽快采取防范措施</el-radio
                    >
                  </el-radio-group>
                </el-form-item>

                <el-form-item label-width="220px" label="下周重点工作：">
                  <el-input
                    style="width: 90%"
                    resize="none"
                    :rows="4"
                    type="textarea"
                    v-model="table2.item4_value"
                    placeholder="请输入"
                  />
                </el-form-item>

                <el-form-item label-width="220px" label="质量安全员意见：">
                  <el-input
                    style="width: 90%"
                    resize="none"
                    :rows="4"
                    type="textarea"
                    v-model="table2.QS_officer_comments"
                    placeholder="请输入"
                  />
                </el-form-item>

                <el-form-item label-width="220px" label="质量安全总监意见：">
                  <el-input
                    style="width: 90%"
                    resize="none"
                    :rows="4"
                    type="textarea"
                    v-model="table2.QS_director_comments"
                    placeholder="请输入"
                  />
                </el-form-item>
              </el-form>
            </div>

            <el-scrollbar :height="activeHeight_Scroll">
              <table
                style="line-height: 20px"
                class="my_table"
                border="2px"
                width="100%"
              >
                <tr>
                  <td
                    rowspan="2"
                    colspan="3"
                    style="
                      text-align: center;
                      font-size: 16px;
                      font-weight: bold;
                      width: 250px;
                    "
                  >
                    <img
                      style="width: 240px"
                      src=""
                    />
                  </td>
                  <td
                    rowspan="2"
                    colspan="2"
                    style="
                      text-align: center;
                      font-size: 22px;
                      line-height: 27px;
                      width: 321px;
                      font-weight: bold;
                    "
                  >
                    压力容器设计<br />
                    质量安全排查治理报告
                  </td>
                  <td
                    style="
                      text-align: center;
                      font-size: 16px;
                      font-weight: bold;
                      width: 100px;
                    "
                  >
                    编 &nbsp;&nbsp; 号
                  </td>
                  <td
                    style="
                      text-align: center;
                      font-size: 14px;
                      font-weight: bold;
                      color: #ccc;
                    "
                  >
                    自动生成
                  </td>
                </tr>

                <tr>
                  <td
                    style="
                      text-align: center;
                      font-size: 16px;
                      font-weight: bold;
                      width: 100px;
                    "
                  >
                    日 &nbsp;&nbsp; 期
                  </td>
                  <td
                    style="
                      text-align: center;
                      font-size: 16px;
                      font-weight: bold;
                    "
                  >
                    <el-date-picker
                      style="width: 80%"
                      size="small"
                      v-model="table2.report_time"
                      value-format="YYYY-MM-DD"
                      type="date"
                      placeholder="请选择日期"
                    />
                  </td>
                </tr>

                <tr>
                  <td
                    colspan="3"
                    style="
                      text-align: left;
                      font-size: 14px;
                      font-weight: bold;
                      width: 250px;
                    "
                  >
                    上周特种设备（压力容器）设计质量安全风险隐患问题整改核实情况
                  </td>
                  <td
                    colspan="4"
                    style="text-align: left; font-size: 14px; font-weight: bold"
                  >
                    <el-input
                      style="width: 100%"
                      resize="none"
                      :rows="5"
                      type="textarea"
                      v-model="table2.item1_value"
                      placeholder="请输入"
                    />
                  </td>
                </tr>

                <tr>
                  <td
                    colspan="3"
                    style="
                      text-align: left;
                      font-size: 14px;
                      font-weight: bold;
                      width: 250px;
                    "
                  >
                    本周特种设备（压力容器）设计主要质量安全风险隐患和整改情况
                  </td>
                  <td
                    colspan="4"
                    style="text-align: left; font-size: 14px; font-weight: bold"
                  >
                    <el-input
                      style="width: 100%"
                      resize="none"
                      :rows="5"
                      type="textarea"
                      v-model="table2.item2_value"
                      placeholder="请输入"
                    />
                  </td>
                </tr>

                <tr>
                  <td
                    colspan="3"
                    style="text-align: left; font-size: 14px; font-weight: bold"
                  >
                    本周特种设备（压力容器）设计质量安全管理情况评价
                  </td>
                  <td
                    colspan="4"
                    style="
                      text-align: left;
                      font-size: 14px;
                      font-weight: bold;
                      width: 250px;
                    "
                  >
                    <el-radio-group
                      style="width: 100%; display: inherit"
                      v-model="table2.item3_value"
                      class="ml-4"
                    >
                      <el-radio :label="true" size="small"
                        >质量安全风险可控，无较大质量安全风险隐患</el-radio
                      >
                      <br />
                      <el-radio :label="false" size="small"
                        >存在质量安全风险隐患，需尽快采取防范措施</el-radio
                      >
                    </el-radio-group>
                  </td>
                </tr>

                <tr>
                  <td
                    colspan="3"
                    style="
                      text-align: left;
                      font-size: 14px;
                      font-weight: bold;
                      width: 250px;
                    "
                  >
                    下周重点工作
                  </td>
                  <td
                    colspan="4"
                    style="text-align: left; font-size: 14px; font-weight: bold"
                  >
                    <el-input
                      style="width: 100%"
                      resize="none"
                      :rows="5"
                      type="textarea"
                      v-model="table2.item4_value"
                      placeholder="请输入"
                    />
                  </td>
                </tr>

                <tr>
                  <td
                    colspan="7"
                    style="text-align: left; font-size: 14px; font-weight: bold"
                  >
                    质量安全员意见：
                    <div style="margin-top: 10px; margin-bottom: 10px">
                      <el-input
                        style="width: 100%"
                        resize="none"
                        :rows="5"
                        type="textarea"
                        v-model="table2.QS_officer_comments"
                        placeholder="请输入"
                      />
                    </div>
                  </td>
                </tr>

                <tr>
                  <td
                    colspan="7"
                    style="text-align: left; font-size: 14px; font-weight: bold"
                  >
                    质量安全总监意见：
                    <div style="margin-top: 10px; margin-bottom: 10px">
                      <el-input
                        style="width: 100%"
                        resize="none"
                        :rows="5"
                        type="textarea"
                        v-model="table2.QS_director_comments"
                        placeholder="请输入"
                      />
                    </div>
                  </td>
                </tr>
              </table>
            </el-scrollbar>

            <div style="height: 10px"></div>
            <div style="display: flex; justify-content: flex-end">
              <el-button
                style="text-align: center"
                @click="saveTable2"
                type="primary"
                size="small"
                >保存表格</el-button
              >
            </div>
          </div>
        </el-tab-pane>

        <el-tab-pane
          label="月压力容器设计质量安全调度会会议纪要 "
          name="月压力容器设计质量安全调度会会议纪要"
        >
          <el-scrollbar>
            <div style="margin: 0 300px">
              <div v-if="false">
                <div class="BT_title2">
                  月压力容器设计质量安全调度会会议纪要
                </div>
                <el-form style="margin-bottom: 10px" label-position="left">
                  <!-- <el-form-item label-width="220px" label="纪要编号：">
                  <el-input
                    style="width: 90%"
                    v-model="table3.file_no"
                    placeholder="请输入纪要编号"
                  />
                </el-form-item> -->
                  <el-form-item label-width="220px" label="记录人：">
                    <el-input
                      style="width: 90%"
                      v-model="table3.recorder"
                      placeholder="请输入记录人"
                    />
                  </el-form-item>
                  <el-form-item label-width="220px" label="记录类型：">
                    <div>
                      <el-checkbox
                        v-model="table3.is_need_read"
                        label="请阅知"
                      />
                      <el-checkbox v-model="table3.is_exigency" label="紧急" />
                      <el-checkbox
                        v-model="table3.is_need_reply"
                        label="请回复"
                      />
                    </div>
                  </el-form-item>

                  <el-form-item label-width="220px" label="会议时间：">
                    <el-date-picker
                      v-model="table3.meeting_time"
                      value-format="YYYY-MM-DD"
                      type="date"
                      placeholder="请选择日期"
                      size="default"
                    />
                  </el-form-item>

                  <el-form-item label-width="220px" label="会议地点：">
                    <el-input
                      style="width: 90%"
                      v-model="table3.meeting_address"
                      placeholder="请输入"
                    />
                  </el-form-item>

                  <el-form-item label-width="220px" label="会议主持：">
                    <el-input
                      style="width: 90%"
                      v-model="table3.meeting_host"
                      placeholder="请输入"
                    />
                  </el-form-item>

                  <el-form-item label-width="220px" label="参加人员：">
                    <el-input
                      style="width: 90%"
                      v-model="table3.participant"
                      placeholder="请输入"
                    />
                  </el-form-item>

                  <el-form-item
                    label-width="220px"
                    label="一、本月巡查主要问题："
                  >
                    <el-input
                      style="width: 90%"
                      resize="none"
                      :rows="4"
                      type="textarea"
                      v-model="table3.major_problem"
                      placeholder="请输入"
                    />
                  </el-form-item>

                  <el-form-item
                    label-width="220px"
                    label="二、本月整改方案落实情况："
                  >
                    <el-input
                      style="width: 90%"
                      resize="none"
                      :rows="4"
                      type="textarea"
                      v-model="table3.improvement_status"
                      placeholder="请输入"
                    />
                  </el-form-item>

                  <el-form-item
                    label-width="220px"
                    label="三、本月还未解决的问题："
                  >
                    <el-input
                      style="width: 90%"
                      resize="none"
                      :rows="4"
                      type="textarea"
                      v-model="table3.unsolved_problem"
                      placeholder="请输入"
                    />
                  </el-form-item>

                  <el-form-item
                    label-width="220px"
                    label="四、月调度相关内容（如制度修订、人员岗位职责变化等："
                  >
                    <el-input
                      style="width: 90%"
                      resize="none"
                      :rows="4"
                      type="textarea"
                      v-model="table3.scheduling_content"
                      placeholder="请输入"
                    />
                  </el-form-item>

                  <el-form-item
                    label-width="220px"
                    label="五、其他特种设备（压力容器）设计质量安全事项："
                  >
                    <el-input
                      style="width: 90%"
                      resize="none"
                      :rows="4"
                      type="textarea"
                      v-model="table3.other_QS_items"
                      placeholder="请输入"
                    />
                  </el-form-item>

                  <el-form-item
                    label-width="220px"
                    label="六、会议研究采取的措施："
                  >
                    <el-input
                      style="width: 90%"
                      resize="none"
                      :rows="4"
                      type="textarea"
                      v-model="table3.measures"
                      placeholder="请输入"
                    />
                  </el-form-item>
                </el-form>
              </div>

              <el-scrollbar :height="activeHeight_Scroll">
                <table
                  style="line-height: 20px"
                  class="my_table"
                  border="2px"
                  width="100%"
                >
                  <tr>
                    <td
                      colspan="2"
                      style="
                        text-align: center;
                        font-size: 16px;
                        font-weight: bold;
                        width: 250px;
                      "
                    >
                      <img
                        style="width: 240px"
                        src=""
                      />
                    </td>
                    <td
                      colspan="4"
                      style="
                        text-align: center;
                        font-size: 22px;
                        line-height: 27px;
                        width: 321px;
                        font-weight: bold;
                      "
                    >
                      压力容器设计质量安全调度会<br />
                      会议纪要
                    </td>
                  </tr>

                  <tr>
                    <td
                      style="
                        text-align: center;
                        font-size: 13px;
                        font-weight: bold;
                      "
                    >
                      纪要编号
                    </td>
                    <td
                      style="
                        text-align: center;
                        font-size: 13px;
                        font-weight: bold;
                        color: #ccc;
                      "
                    >
                      自动生成
                    </td>
                    <td
                      style="
                        text-align: center;
                        font-size: 13px;
                        font-weight: bold;
                      "
                    >
                      页 数
                    </td>
                    <td
                      style="
                        text-align: center;
                        font-size: 13px;
                        font-weight: bold;
                      "
                    >
                      共 &nbsp;&nbsp; &nbsp; 页 第 &nbsp;&nbsp; &nbsp; 页
                    </td>
                    <td
                      style="
                        text-align: center;
                        font-size: 13px;
                        font-weight: bold;
                      "
                    >
                      记录人
                    </td>
                    <td
                      style="
                        text-align: center;
                        font-size: 13px;
                        font-weight: bold;
                      "
                    >
                      <el-input
                        size="small"
                        style="width: 100%"
                        v-model="table3.recorder"
                        placeholder="请输入记录人"
                      />
                    </td>
                  </tr>
                  <tr>
                    <td colspan="6">
                      <div class="table-content_my">
                        <div
                          style="
                            display: flex;
                            align-items: center;
                            justify-content: center;
                            margin-bottom: 20px;
                          "
                        >
                          <el-checkbox
                            v-model="table3.is_need_read"
                            label="质量安全风险可控，无较大质量安全风险隐患"
                          />
                          <el-checkbox
                            v-model="table3.is_exigency"
                            label="紧急"
                          />
                          <el-checkbox
                            v-model="table3.is_need_reply"
                            label="请回复"
                          />
                        </div>

                        <div style="font-size: 15px; line-height: 32px">
                          <p>
                            〖<strong>会议</strong><strong>时间</strong>〗
                            &nbsp; &nbsp;
                            <el-date-picker
                              v-model="table3.meeting_time"
                              value-format="YYYY-MM-DD"
                              type="date"
                              placeholder="请选择日期"
                              size="small"
                            />
                          </p>
                          <p>
                            〖<strong>会议</strong><strong>地点</strong>〗
                            &nbsp; &nbsp;
                            <el-input
                              style="width: 23%"
                              size="small"
                              v-model="table3.meeting_address"
                              placeholder="请输入"
                            />
                          </p>
                          <p>
                            〖<strong>会议主持</strong>〗 &nbsp; &nbsp;
                            <el-input
                              style="width: 23%"
                              size="small"
                              v-model="table3.meeting_host"
                              placeholder="请输入"
                            />
                          </p>
                          <p>
                            〖<strong>参加人员</strong>〗 &nbsp; &nbsp;
                            <el-input
                              style="width: 23%"
                              size="small"
                              v-model="table3.participant"
                              placeholder="请输入"
                            />
                          </p>
                        </div>
                      </div>
                    </td>
                  </tr>
                  <tr>
                    <td colspan="6">
                      <div style="font-size: 15px; line-height: 32px">
                        <p><strong>〖会议内容〗</strong></p>
                        <p>&nbsp; &nbsp; &nbsp; &nbsp; 一、本月巡查主要问题</p>
                        <p>
                          &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                          <el-input
                            style="width: 90%"
                            resize="none"
                            :rows="3"
                            type="textarea"
                            v-model="table3.major_problem"
                            placeholder="请输入"
                          />
                        </p>
                        <p>
                          &nbsp; &nbsp; &nbsp; &nbsp;二、本月整改方案落实情况
                        </p>
                        <p>
                          &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                          <el-input
                            style="width: 90%"
                            resize="none"
                            :rows="3"
                            type="textarea"
                            v-model="table3.improvement_status"
                            placeholder="请输入"
                          />
                        </p>
                        <p>&nbsp; &nbsp; &nbsp; &nbsp;三、本月还未解决的问题</p>
                        <p>
                          &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                          <el-input
                            style="width: 90%"
                            resize="none"
                            :rows="3"
                            type="textarea"
                            v-model="table3.unsolved_problem"
                            placeholder="请输入"
                          />
                        </p>
                        <p>
                          &nbsp; &nbsp; &nbsp;
                          &nbsp;四、月调度相关内容（如制度修订、人员岗位职责变化等）
                        </p>
                        <p>
                          &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                          <el-input
                            style="width: 90%"
                            resize="none"
                            :rows="3"
                            type="textarea"
                            v-model="table3.scheduling_content"
                            placeholder="请输入"
                          />
                        </p>
                        <p>
                          &nbsp; &nbsp; &nbsp;
                          &nbsp;五、其他特种设备（压力容器）设计质量安全事项
                        </p>
                        <p>
                          &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                          <el-input
                            style="width: 90%"
                            resize="none"
                            :rows="3"
                            type="textarea"
                            v-model="table3.other_QS_items"
                            placeholder="请输入"
                          />
                        </p>
                        <p>&nbsp; &nbsp; &nbsp; &nbsp;六、会议研究采取的措施</p>
                        <p>
                          &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                          <el-input
                            style="width: 90%"
                            resize="none"
                            :rows="3"
                            type="textarea"
                            v-model="table3.measures"
                            placeholder="请输入"
                          />
                        </p>
                      </div>
                    </td>
                  </tr>
                </table>
              </el-scrollbar>

              <div style="height: 10px"></div>
              <div style="display: flex; justify-content: flex-end">
                <el-button
                  style="text-align: center"
                  @click="saveTable3"
                  type="primary"
                  size="small"
                  >保存表格</el-button
                >
              </div>
            </div>
          </el-scrollbar>
        </el-tab-pane>
      </el-tabs>
    </div>
  </div>
</template>

<script setup>
import { ref, onMounted } from "vue";
import {
  UpdatePressureVesselQSSchedulingMettingRecord,
  UpdatePressureVesselQSDialyCheckRecord,
  UpdatePressureVesselQSWeeksGovernRecord,
  CreatePressureVesselQSDialyCheckRecord,
  SavePressureVesselQSWeeksGovernRecord,
  SavePressureVesselQSSchedulingMettingRecord,
} from "../../api/projectManage/projectList";

import {
  GetAllPressureVesselQSDialyCheckRecord,
  GetAllPressureVesselQSWeeksGovernRecord,
  GetAllPressureVesselQSSchedulingMettingRecord,
} from "../../api/projectManage/projectList";

import { ElMessage } from "element-plus";
let activeName = ref("日压力容器设计质量安全检查");

// 动态高度
let activeHeight = ref(0);
// 第二张表格高度  预留
let activeHeightDouble = ref(0);
let tableData1 = ref([]);
let tableData2 = ref([]);
let tableData3 = ref([]);
// 表格滑动高度
let activeHeight_Scroll = ref("0px");
onMounted(async () => {
  // 从数据库获得各个表格的数据 回填
  let res1 = await GetAllPressureVesselQSDialyCheckRecord();
  res1.sort((a, b) => {
    return new Date(a.check_time) - new Date(b.check_time);
  });

  tableData1.value = res1;

  let res2 = await GetAllPressureVesselQSWeeksGovernRecord();
  tableData2.value = res2;

  let res3 = await GetAllPressureVesselQSSchedulingMettingRecord();
  tableData3.value = res3;

  // 每个表格长度比较长 会撑开，需要确定一个滚动高度
  activeHeight_Scroll.value = `${
    document.querySelector(".system-role-container").clientHeight - 150
  }px`;
  activeHeightDouble.value = `${
    document.querySelector(".system-role-container").clientHeight - 200
  }px`;
  window.addEventListener("resize", () => {
    activeHeightDouble.value = `${
      document.querySelector(".system-role-container").clientHeight - 200
    }px`;
    activeHeight_Scroll.value = `${
      document.querySelector(".system-role-container").clientHeight - 150
    }px`;
  });
});


// 表1数据展示源
let table1 = ref({
  file_no: "",
  date: "",
  check_file_nos: "",
  tableData: [
    {
      title: "检查压力容器设计产品是否超出公司设计许可范围",
      check_item_result: "√",
      processing_item_result: "-",
      quality_safety_officer: JSON.parse(localStorage.getItem("userMessage"))
        .user_name,
      check_item_note: "",
    },
    {
      title:
        "检查压力容器各级设计人员安排是否符合公司《压力容器各级设计人员任命文件》的要求",
      check_item_result: "√",
      processing_item_result: "-",
      quality_safety_officer: JSON.parse(localStorage.getItem("userMessage"))
        .user_name,
      check_item_note: "",
    },
    {
      title: "检查特种设备（压力容器）设计许可印章是否有批准使用记录",
      check_item_result: "√",
      processing_item_result: "-",
      quality_safety_officer: JSON.parse(localStorage.getItem("userMessage"))
        .user_name,
      check_item_note: "",
    },
    {
      title: "检查压力容器设计专业评审记录是否齐全、规范",
      check_item_result: "√",
      processing_item_result: "-",
      quality_safety_officer: JSON.parse(localStorage.getItem("userMessage"))
        .user_name,
      check_item_note: "",
    },
    {
      title: "检查专业设计统一规定是否规范、完整",
      check_item_result: "√",
      processing_item_result: "-",
      quality_safety_officer: JSON.parse(localStorage.getItem("userMessage"))
        .user_name,
      check_item_note: "",
    },
    {
      title: "检查压力容器设计是否按照程序文件执行",
      check_item_result: "√",
      processing_item_result: "-",
      quality_safety_officer: JSON.parse(localStorage.getItem("userMessage"))
        .user_name,
      check_item_note: "",
    },
    {
      title: "检查压力容器设计文件深度是否满足设计输入或者存在漏项",
      check_item_result: "√",
      processing_item_result: "-",
      quality_safety_officer: JSON.parse(localStorage.getItem("userMessage"))
        .user_name,
      check_item_note: "",
    },
    {
      title: "检查压力容器设计产品文件校审记录是否齐全、规范",
      check_item_result: "√",
      processing_item_result: "-",
      quality_safety_officer: JSON.parse(localStorage.getItem("userMessage"))
        .user_name,
      check_item_note: "",
    },
    {
      title: "检查标准化审查记录是否齐全、规范",
      check_item_result: "√",
      processing_item_result: "-",
      quality_safety_officer: JSON.parse(localStorage.getItem("userMessage"))
        .user_name,
      check_item_note: "",
    },
    {
      title: "检查设计变更是否按规定办理设计变更手续",
      check_item_result: "√",
      processing_item_result: "-",
      quality_safety_officer: JSON.parse(localStorage.getItem("userMessage"))
        .user_name,
      check_item_note: "",
    },
    {
      title: "检查归档设计文件类型是否完整",
      check_item_result: "√",
      processing_item_result: "-",
      quality_safety_officer: JSON.parse(localStorage.getItem("userMessage"))
        .user_name,
      check_item_note: "",
    },
    {
      title: "检查风险评估报告是否完整",
      check_item_result: "√",
      processing_item_result: "-",
      quality_safety_officer: JSON.parse(localStorage.getItem("userMessage"))
        .user_name,
      check_item_note: "",
    },
    {
      title: "政府监督、通报及预警",
      check_item_result: "√",
      processing_item_result: "-",
      quality_safety_officer: JSON.parse(localStorage.getItem("userMessage"))
        .user_name,
      check_item_note: "",
    },
    {
      title: "投诉举报",
      check_item_result: "√",
      processing_item_result: "-",
      quality_safety_officer: JSON.parse(localStorage.getItem("userMessage"))
        .user_name,
      check_item_note: "",
    },
    {
      title: "舆情信息",
      check_item_result: "√",
      processing_item_result: "-",
      quality_safety_officer: JSON.parse(localStorage.getItem("userMessage"))
        .user_name,
      check_item_note: "",
    },
  ],
  precautions: "",
});
// 表2数据展示源
let table2 = ref({
  file_no: "",
  item1_value: "",
  item2_value: "",
  item3_value: true,
  item4_value: "",
  QS_officer_comments: "",
  QS_officer: "",
  QS_officer_time: "",
  QS_director_comments: "",
  QS_director: "",
  QS_director_time: "",
});

let ttt2= async(date,index) =>{
  let obj = {"file_no":"ED-YRPC-2025-1","item1_value":"无","item2_value":"无","item3_value":true,"item4_value":"无","QS_officer_comments":"无","QS_officer":"","QS_officer_time":"","QS_director_comments":"无","QS_director":"","QS_director_time":"","report_time":"2025-04-16","modify_user":"任超"}
 obj.file_no = `ED-YRPC-2025-${index}`
 obj.report_time = date
 let res = await SavePressureVesselQSWeeksGovernRecord(obj);

}

let saveAuto2 = async() => {
  function getLastThursday(date = new Date()) {
  const d = new Date(date);
  d.setHours(0, 0, 0, 0);
  // 找到最近的过去周四（包含今天）
  while (d.getDay() !== 4) {
    d.setDate(d.getDate() - 1);
  }
  return d;
}

function formatDate(date) {
  const year = date.getFullYear();
  const month = String(date.getMonth() + 1).padStart(2, '0');
  const day = String(date.getDate()).padStart(2, '0');
  return `${year}-${month}-${day}`;
}

// 设置起始日期为 2024-06-13（周四）
const startDate = new Date(2024, 5, 13); // 注意：月份是 0-based（5=六月）
startDate.setHours(0, 0, 0, 0);

// 检查起始日期是否为周四
if (startDate.getDay() !== 4) {
  throw new Error("起始日期不是周四！");
}

// 获取截止日期（当前时间的最后一个周四）
const endDate = getLastThursday();

// 生成所有周四
const thursdays = [];
let currentDate = new Date(startDate);

while (currentDate <= endDate) {
  thursdays.push(formatDate(currentDate));
  currentDate = new Date(currentDate);
  currentDate.setDate(currentDate.getDate() + 7); // 增加7天
}

let arrs = thursdays.slice(thursdays.indexOf('2024-12-26')+1)
console.log(arrs)
let index = 1
for(let i of arrs){
  ttt2(i,index)
  index ++
}
// 打印结果
console.log("周四日期数组：", arrs);
}


// 保存表2数据
let saveTable2 = async () => {
  // 校验时间是否填入
  if (!table2.value.report_time) {
    ElMessage({
      type: "error",
      message: "请选择时间",
    });
    return;
  }

  // 如果表格里面没有数据 则为第一条新数据 注意这里插入逻辑和有数据试的插入逻辑不一样
  if (tableData2.value.length == 0) {
    let obj = {
      ...table2.value,
      modify_user: JSON.parse(localStorage.getItem("userMessage")).user_name,
    };
    obj.file_no = `ED-YRPC-${new Date(
      table2.value.report_time
    ).getFullYear()}-01`;
    let res = await SavePressureVesselQSWeeksGovernRecord(obj);
    if (res == "True") {
      ElMessage({
        type: "success",
        message: "保存成功",
      });
    } else {
      ElMessage({
        type: "error",
        message: res.data,
      });
    }
  } else {
    let obj = {
      ...table2.value,
      modify_user: JSON.parse(localStorage.getItem("userMessage")).user_name,
    };
    tableData2.value.push(obj);
    tableData2.value.sort((a, b) => {
      return new Date(a.report_time) - new Date(b.report_time);
    });
    let index = 0;
    let lastYear = "";
    tableData2.value.forEach((v) => {
      if (new Date(v.report_time).getFullYear() == lastYear) {
        index++;
        v.file_no = `ED-YRPC-${new Date(v.report_time).getFullYear()}-${index}`;
      } else {
        index = 1;
        v.file_no = `ED-YRPC-${new Date(v.report_time).getFullYear()}-${index}`;
      }
      lastYear = new Date(v.report_time).getFullYear();
    });

    let hasData = tableData2.value.filter((v) => {
      return v.oid;
    });
    let newData = tableData2.value.filter((v) => {
      return !v.oid;
    });
    console.log(hasData)
    hasData.forEach(async (v, i) => {
      await UpdatePressureVesselQSWeeksGovernRecord({ ...v });
      if (i == hasData.length - 1) {
        ElMessage({
          type: "success",
          message: "保存成功",
        });
      }
    });

    let res = await SavePressureVesselQSWeeksGovernRecord(newData[0]);
    if (res == "True") {
    } else {
      ElMessage({
        type: "error",
        message: res.data,
      });
    }
  }
  // 重置表二数据
  table2.value = {
    file_no: "",
    item1_value: "",
    item2_value: "",
    item3_value: true,
    item4_value: "",
    QS_officer_comments: "",
    QS_officer: "",
    QS_officer_time: "",
    QS_director_comments: "",
    QS_director: "",
    QS_director_time: "",
  };
  
  // 从数据库获取最新数据 保持前后端一致
  let res2 = await GetAllPressureVesselQSWeeksGovernRecord();
  tableData2.value = res2;
};

// 保存表三数据
let saveTable3 = async () => {
  // 校验时间是否填入
  if (!table3.value.meeting_time) {
    ElMessage({
      type: "error",
      message: "请选择时间",
    });
    return;
  }
  
  
  if (tableData3.value.length == 0) {
    // 根据目前时间获取序号
    table3.value.file_no = `EQ-YRDD-${new Date(
      table3.value.meeting_time
    ).getFullYear()}-01`;
    // 请求接口进行插入
    let res = await SavePressureVesselQSSchedulingMettingRecord(table3.value);
    if (res == "True") {
      ElMessage({
        type: "success",
        message: "保存成功",
      });
    } else {
      ElMessage({
        type: "error",
        message: res.data,
      });
    }
  } else {
    // 如果要修改之前的数据 表格的序号需要改变为最新，以致于其他数据的需要也需要发生变化 这里为了防止出现序号不正确的BUG设置的
    tableData3.value.push(table3.value);
    tableData3.value.sort((a, b) => {
      return new Date(a.meeting_time) - new Date(b.meeting_time);
    });
    let index = 0;
    let lastYear = "";
    // 循环每个元素并且添加格式
    tableData3.value.forEach((v) => {
      if (new Date(v.meeting_time).getFullYear() == lastYear) {
        index++;
        v.file_no = `EQ-YRDD-${new Date(
          v.meeting_time
        ).getFullYear()}-${index}`;
      } else {
        index = 1;
        v.file_no = `EQ-YRDD-${new Date(
          v.meeting_time
        ).getFullYear()}-${index}`;
      }
      lastYear = new Date(v.meeting_time).getFullYear();
    });

    let hasData = tableData3.value.filter((v) => {
      return v.oid;
    });
    let newData = tableData3.value.filter((v) => {
      return !v.oid;
    });
    // 使用新格式
    hasData.forEach(async (v, i) => {
      await UpdatePressureVesselQSSchedulingMettingRecord({ ...v });
      if (i == hasData.length - 1) {
        ElMessage({
          type: "success",
          message: "保存成功",
        });
      }
    });
    // 最新的表格数据插入
    let res = await SavePressureVesselQSSchedulingMettingRecord(newData[0]);
    if (res == "True") {
    } else {
      ElMessage({
        type: "error",
        message: res.data,
      });
    }
  }
  // 重置数据
  table3.value = {
    file_no: "",
    recorder: "",
    is_need_read: true,
    is_exigency: true,
    is_need_reply: true,
    meeting_time: "",
    meeting_address: "",
    meeting_host: "",
    participant: "",
    major_problem: "",
    improvement_status: "",
    unsolved_problem: "",
    scheduling_content: "",
    other_QS_items: "",
    measures: "",
    modify_user: JSON.parse(localStorage.getItem("userMessage")).user_name,
  };
  // 获取最新数据
  let res3 = await GetAllPressureVesselQSSchedulingMettingRecord();
  tableData3.value = res3;
};

// 表单中需要修改的时间
let timeChange = ref(false);
let changeTime1 = (data) => {
  // 选择的时间不能比表格中最新数据的时间还要早
  if (
    new Date(tableData1.value[tableData1.value.length - 1]?.check_time) <
    new Date(data)
  ) {
    timeChange.value = false;
  } else {
    timeChange.value = true;
  }
  
};

let ttt =async (date,index) => {

  console.log(tableData1.value)
  console.log(date)
  let obj = {
    "check_item1_result": "√",
    "processing_item1_result": "-",
    "quality_safety_officer1": "任超",
    "check_item1_note": "",
    "check_item2_result": "√",
    "processing_item2_result": "-",
    "quality_safety_officer2": "任超",
    "check_item2_note": "",
    "check_item3_result": "√",
    "processing_item3_result": "-",
    "quality_safety_officer3": "任超",
    "check_item3_note": "",
    "check_item4_result": "√",
    "processing_item4_result": "-",
    "quality_safety_officer4": "任超",
    "check_item4_note": "",
    "check_item5_result": "√",
    "processing_item5_result": "-",
    "quality_safety_officer5": "任超",
    "check_item5_note": "",
    "check_item6_result": "√",
    "processing_item6_result": "-",
    "quality_safety_officer6": "任超",
    "check_item6_note": "",
    "check_item7_result": "√",
    "processing_item7_result": "-",
    "quality_safety_officer7": "任超",
    "check_item7_note": "",
    "check_item8_result": "√",
    "processing_item8_result": "-",
    "quality_safety_officer8": "任超",
    "check_item8_note": "",
    "check_item9_result": "√",
    "processing_item9_result": "-",
    "quality_safety_officer9": "任超",
    "check_item9_note": "",
    "check_item10_result": "√",
    "processing_item10_result": "-",
    "quality_safety_officer10": "任超",
    "check_item10_note": "",
    "check_item11_result": "√",
    "processing_item11_result": "-",
    "quality_safety_officer11": "任超",
    "check_item11_note": "",
    "check_item12_result": "√",
    "processing_item12_result": "-",
    "quality_safety_officer12": "任超",
    "check_item12_note": "",
    "check_item13_result": "√",
    "processing_item13_result": "-",
    "quality_safety_officer13": "任超",
    "check_item13_note": "",
    "check_item14_result": "√",
    "processing_item14_result": "-",
    "quality_safety_officer14": "任超",
    "check_item14_note": "",
    "check_item15_result": "√",
    "processing_item15_result": "-",
    "quality_safety_officer15": "任超",
    "check_item15_note": "",
    "file_no": "",
    "check_file_nos": "无",
    "date": "",
    "precautions": "无",
    "check_time": date,
    "modify_user": "任超"
}

table1.value.check_time = date


    
     obj.file_no = `ED-YRJC-2025-${index}`
     
     obj.check_time = table1.value.check_time;
     
    console.log(obj)
     let res = await CreatePressureVesselQSDialyCheckRecord(obj);
     if (res == "True") {
       ElMessage({
         type: "success",
         message: "保存成功",
       });
     } else {
       ElMessage({
         type: "error",
         message: res.data,
       });
     }
 
  



}

let saveTable1Auto = async () => {
  function getDateArray(startDateStr, endDateStr) {
  const startDate = new Date(startDateStr);
  const endDate = new Date(endDateStr);
  const dates = [];

  // 统一时间为午夜，避免时区问题
  startDate.setHours(0, 0, 0, 0);
  endDate.setHours(0, 0, 0, 0);

  // 如果起始日期晚于结束日期，返回空数组
  if (startDate > endDate) return [];

  // 逐天遍历
  const currentDate = new Date(startDate);
  while (currentDate <= endDate) {
    const year = currentDate.getFullYear();
    const month = String(currentDate.getMonth() + 1).padStart(2, '0');
    const day = String(currentDate.getDate()).padStart(2, '0');
    dates.push(`${year}-${month}-${day}`);
    
    // 增加一天
    currentDate.setDate(currentDate.getDate() + 1);
  }

  return dates;
}

// 调用函数（注意月份是实际数值）
const dateArray = getDateArray("2025-01-01", "2025-4-16");
console.log(dateArray)

 let no = 1

 for(let i of dateArray){

    ttt(i,no)
    no++

 }
}

// 保存表格1中的数据
let saveTable1 = async () => {
  if (timeChange.value) {
    if (!table1.value.check_time) {
      ElMessage({
        type: "error",
        message: "请选择时间",
      });
      return;
    }

    if (tableData1.value.length == 0) {
      table1.value.file_no = `ED-YRJC-${new Date(
        table1.value.check_time
      ).getFullYear()}-01`;
      let obj = {};
      table1.value.tableData.forEach((v, i) => {
        obj[`check_item${i + 1}_result`] = v.check_item_result;
        obj[`processing_item${i + 1}_result`] = v.processing_item_result;
        obj[`quality_safety_officer${i + 1}`] = v.quality_safety_officer;
        obj[`check_item${i + 1}_note`] = v.check_item_note;
      });
      obj.file_no = table1.value.file_no;
      obj.check_file_nos = table1.value.check_file_nos;
      obj.date = table1.value.date;
      obj.precautions = table1.value.precautions;
      obj.check_time = table1.value.check_time;
      obj.modify_user = JSON.parse(
        localStorage.getItem("userMessage")
      ).user_name;

      let res = await CreatePressureVesselQSDialyCheckRecord(obj);
      if (res == "True") {
        ElMessage({
          type: "success",
          message: "保存成功",
        });
      } else {
        ElMessage({
          type: "error",
          message: res.data,
        });
      }
    } else {
      let obj = {};
      table1.value.tableData.forEach((v, i) => {
        obj[`check_item${i + 1}_result`] = v.check_item_result;
        obj[`processing_item${i + 1}_result`] = v.processing_item_result;
        obj[`quality_safety_officer${i + 1}`] = v.quality_safety_officer;
        obj[`check_item${i + 1}_note`] = v.check_item_note;
      });
      obj.file_no = table1.value.file_no;
      obj.check_file_nos = table1.value.check_file_nos;
      obj.date = table1.value.date;
      obj.precautions = table1.value.precautions;
      obj.check_time = table1.value.check_time;
      obj.modify_user = JSON.parse(
        localStorage.getItem("userMessage")
      ).user_name;

      tableData1.value.push(obj);
      tableData1.value.sort((a, b) => {
        return new Date(a.check_time) - new Date(b.check_time);
      });

      let index = 0;
      let lastYear = "";
      tableData1.value.forEach((v) => {
        if (new Date(v.check_time).getFullYear() == lastYear) {
          index++;
          v.file_no = `ED-YRJC-${new Date(
            v.check_time
          ).getFullYear()}-${index}`;
        } else {
          index = 1;
          v.file_no = `ED-YRJC-${new Date(
            v.check_time
          ).getFullYear()}-${index}`;
        }
        lastYear = new Date(v.check_time).getFullYear();
      });

      let hasData = tableData1.value.filter((v) => {
        return v.oid;
      });
      let newData = tableData1.value.filter((v) => {
        return !v.oid;
      });

      hasData.forEach(async (v, i) => {
        await UpdatePressureVesselQSDialyCheckRecord({ ...v });
        if (i == hasData.length - 1) {
          ElMessage({
            type: "success",
            message: "保存成功",
          });
        }
      });

      console.log(JSON.stringify(newData[0]));
      let res = await CreatePressureVesselQSDialyCheckRecord(newData[0]);
      if (res == "True") {
      } else {
        ElMessage({
          type: "error",
          message: res.data,
        });
      }
    }
    table1.value = {
      file_no: "",
      date: "",
      check_file_nos: "",
      tableData: [
        {
          title: "检查压力容器设计产品是否超出公司设计许可范围",
          check_item_result: "√",
          processing_item_result: "-",
          quality_safety_officer: JSON.parse(
            localStorage.getItem("userMessage")
          ).user_name,
          check_item_note: "",
        },
        {
          title:
            "检查压力容器各级设计人员安排是否符合公司《压力容器各级设计人员任命文件》的要求",
          check_item_result: "√",
          processing_item_result: "-",
          quality_safety_officer: JSON.parse(
            localStorage.getItem("userMessage")
          ).user_name,
          check_item_note: "",
        },
        {
          title: "检查特种设备（压力容器）设计许可印章是否有批准使用记录",
          check_item_result: "√",
          processing_item_result: "-",
          quality_safety_officer: JSON.parse(
            localStorage.getItem("userMessage")
          ).user_name,
          check_item_note: "",
        },
        {
          title: "检查压力容器设计专业评审记录是否齐全、规范",
          check_item_result: "√",
          processing_item_result: "-",
          quality_safety_officer: JSON.parse(
            localStorage.getItem("userMessage")
          ).user_name,
          check_item_note: "",
        },
        {
          title: "检查专业设计统一规定是否规范、完整",
          check_item_result: "√",
          processing_item_result: "-",
          quality_safety_officer: JSON.parse(
            localStorage.getItem("userMessage")
          ).user_name,
          check_item_note: "",
        },
        {
          title: "检查压力容器设计是否按照程序文件执行",
          check_item_result: "√",
          processing_item_result: "-",
          quality_safety_officer: JSON.parse(
            localStorage.getItem("userMessage")
          ).user_name,
          check_item_note: "",
        },
        {
          title: "检查压力容器设计文件深度是否满足设计输入或者存在漏项",
          check_item_result: "√",
          processing_item_result: "-",
          quality_safety_officer: JSON.parse(
            localStorage.getItem("userMessage")
          ).user_name,
          check_item_note: "",
        },
        {
          title: "检查压力容器设计产品文件校审记录是否齐全、规范",
          check_item_result: "√",
          processing_item_result: "-",
          quality_safety_officer: JSON.parse(
            localStorage.getItem("userMessage")
          ).user_name,
          check_item_note: "",
        },
        {
          title: "检查标准化审查记录是否齐全、规范",
          check_item_result: "√",
          processing_item_result: "-",
          quality_safety_officer: JSON.parse(
            localStorage.getItem("userMessage")
          ).user_name,
          check_item_note: "",
        },
        {
          title: "检查设计变更是否按规定办理设计变更手续",
          check_item_result: "√",
          processing_item_result: "-",
          quality_safety_officer: JSON.parse(
            localStorage.getItem("userMessage")
          ).user_name,
          check_item_note: "",
        },
        {
          title: "检查归档设计文件类型是否完整",
          check_item_result: "√",
          processing_item_result: "-",
          quality_safety_officer: JSON.parse(
            localStorage.getItem("userMessage")
          ).user_name,
          check_item_note: "",
        },
        {
          title: "检查风险评估报告是否完整",
          check_item_result: "√",
          processing_item_result: "-",
          quality_safety_officer: JSON.parse(
            localStorage.getItem("userMessage")
          ).user_name,
          check_item_note: "",
        },
        {
          title: "政府监督、通报及预警",
          check_item_result: "√",
          processing_item_result: "-",
          quality_safety_officer: JSON.parse(
            localStorage.getItem("userMessage")
          ).user_name,
          check_item_note: "",
        },
        {
          title: "投诉举报",
          check_item_result: "√",
          processing_item_result: "-",
          quality_safety_officer: JSON.parse(
            localStorage.getItem("userMessage")
          ).user_name,
          check_item_note: "",
        },
        {
          title: "舆情信息",
          check_item_result: "√",
          processing_item_result: "-",
          quality_safety_officer: JSON.parse(
            localStorage.getItem("userMessage")
          ).user_name,
          check_item_note: "",
        },
      ],
      precautions: "",
    };

    let res1 = await GetAllPressureVesselQSDialyCheckRecord();
    res1.sort((a, b) => {
      return new Date(a.check_time) - new Date(b.check_time);
    });
    tableData1.value = res1;
  } else {
    if (!table1.value.check_time) {
      ElMessage({
        type: "error",
        message: "请选择时间",
      });
      return;
    }

    let oldFileNo = tableData1.value[tableData1.value.length - 1]?.file_no;

    if (
      new Date(
        tableData1.value[tableData1.value.length - 1]?.check_time
      ).getFullYear() == new Date(table1.value.check_time).getFullYear()
    ) {
      let num = oldFileNo.match(/-(\d+)$/)[1];
      num++;
      table1.value.file_no = `ED-YRJC-${new Date(
        table1.value.check_time
      ).getFullYear()}-${num}`;
    } else {
      table1.value.file_no = `ED-YRJC-${new Date(
        table1.value.check_time
      ).getFullYear()}-1`;
    }

    let obj = {};
    table1.value.tableData.forEach((v, i) => {
      obj[`check_item${i + 1}_result`] = v.check_item_result;
      obj[`processing_item${i + 1}_result`] = v.processing_item_result;
      obj[`quality_safety_officer${i + 1}`] = v.quality_safety_officer;
      obj[`check_item${i + 1}_note`] = v.check_item_note;
    });
    obj.file_no = table1.value.file_no;
    obj.check_file_nos = table1.value.check_file_nos;
    obj.date = table1.value.date;
    obj.precautions = table1.value.precautions;
    obj.check_time = table1.value.check_time;
    obj.modify_user = JSON.parse(localStorage.getItem("userMessage")).user_name;

    let res = await CreatePressureVesselQSDialyCheckRecord(obj);
    if (res == "True") {
      ElMessage({
        type: "success",
        message: "保存成功",
      });
    } else {
      ElMessage({
        type: "error",
        message: res.data,
      });
    }

    table1.value = {
      file_no: "",
      date: "",
      check_file_nos: "",
      tableData: [
        {
          title: "检查压力容器设计产品是否超出公司设计许可范围",
          check_item_result: "√",
          processing_item_result: "-",
          quality_safety_officer: JSON.parse(
            localStorage.getItem("userMessage")
          ).user_name,
          check_item_note: "",
        },
        {
          title:
            "检查压力容器各级设计人员安排是否符合公司《压力容器各级设计人员任命文件》的要求",
          check_item_result: "√",
          processing_item_result: "-",
          quality_safety_officer: JSON.parse(
            localStorage.getItem("userMessage")
          ).user_name,
          check_item_note: "",
        },
        {
          title: "检查特种设备（压力容器）设计许可印章是否有批准使用记录",
          check_item_result: "√",
          processing_item_result: "-",
          quality_safety_officer: JSON.parse(
            localStorage.getItem("userMessage")
          ).user_name,
          check_item_note: "",
        },
        {
          title: "检查压力容器设计专业评审记录是否齐全、规范",
          check_item_result: "√",
          processing_item_result: "-",
          quality_safety_officer: JSON.parse(
            localStorage.getItem("userMessage")
          ).user_name,
          check_item_note: "",
        },
        {
          title: "检查专业设计统一规定是否规范、完整",
          check_item_result: "√",
          processing_item_result: "-",
          quality_safety_officer: JSON.parse(
            localStorage.getItem("userMessage")
          ).user_name,
          check_item_note: "",
        },
        {
          title: "检查压力容器设计是否按照程序文件执行",
          check_item_result: "√",
          processing_item_result: "-",
          quality_safety_officer: JSON.parse(
            localStorage.getItem("userMessage")
          ).user_name,
          check_item_note: "",
        },
        {
          title: "检查压力容器设计文件深度是否满足设计输入或者存在漏项",
          check_item_result: "√",
          processing_item_result: "-",
          quality_safety_officer: JSON.parse(
            localStorage.getItem("userMessage")
          ).user_name,
          check_item_note: "",
        },
        {
          title: "检查压力容器设计产品文件校审记录是否齐全、规范",
          check_item_result: "√",
          processing_item_result: "-",
          quality_safety_officer: JSON.parse(
            localStorage.getItem("userMessage")
          ).user_name,
          check_item_note: "",
        },
        {
          title: "检查标准化审查记录是否齐全、规范",
          check_item_result: "√",
          processing_item_result: "-",
          quality_safety_officer: JSON.parse(
            localStorage.getItem("userMessage")
          ).user_name,
          check_item_note: "",
        },
        {
          title: "检查设计变更是否按规定办理设计变更手续",
          check_item_result: "√",
          processing_item_result: "-",
          quality_safety_officer: JSON.parse(
            localStorage.getItem("userMessage")
          ).user_name,
          check_item_note: "",
        },
        {
          title: "检查归档设计文件类型是否完整",
          check_item_result: "√",
          processing_item_result: "-",
          quality_safety_officer: JSON.parse(
            localStorage.getItem("userMessage")
          ).user_name,
          check_item_note: "",
        },
        {
          title: "检查风险评估报告是否完整",
          check_item_result: "√",
          processing_item_result: "-",
          quality_safety_officer: JSON.parse(
            localStorage.getItem("userMessage")
          ).user_name,
          check_item_note: "",
        },
        {
          title: "政府监督、通报及预警",
          check_item_result: "√",
          processing_item_result: "-",
          quality_safety_officer: JSON.parse(
            localStorage.getItem("userMessage")
          ).user_name,
          check_item_note: "",
        },
        {
          title: "投诉举报",
          check_item_result: "√",
          processing_item_result: "-",
          quality_safety_officer: JSON.parse(
            localStorage.getItem("userMessage")
          ).user_name,
          check_item_note: "",
        },
        {
          title: "舆情信息",
          check_item_result: "√",
          processing_item_result: "-",
          quality_safety_officer: JSON.parse(
            localStorage.getItem("userMessage")
          ).user_name,
          check_item_note: "",
        },
      ],
      precautions: "",
    };

    let res1 = await GetAllPressureVesselQSDialyCheckRecord();
    res1.sort((a, b) => {
      return new Date(a.check_time) - new Date(b.check_time);
    });
    tableData1.value = res1;
  }

  timeChange.value = false;
};

let table3 = ref({
  file_no: "",
  recorder: "",
  is_need_read: true,
  is_exigency: true,
  is_need_reply: true,
  meeting_time: "",
  meeting_address: "",
  meeting_host: "",
  participant: "",
  major_problem: "",
  improvement_status: "",
  unsolved_problem: "",
  scheduling_content: "",
  other_QS_items: "",
  measures: "",
  modify_user: JSON.parse(localStorage.getItem("userMessage")).user_name,
});
</script>

<style lang="scss" scoped>
.button_ab {
  position: absolute;
  right: 20px;
  bottom: -20px;
}
.BT_title {
  margin-bottom: 10px;
  text-align: center;
  font-size: 22px;
  font-weight: bold;
}
.BT_title2 {
  margin-bottom: 48px;
  text-align: center;
  font-size: 22px;
  font-weight: bold;
}
.display_flex {
  width: 100%;
  display: flex;
  align-items: center;
}

.my_table {
  flex-wrap: wrap;

  text-align: left;
  border-collapse: collapse;
  tr {
    width: 100%;
  }
  td {
    padding: 8px 24px;
    font-size: 12px;
  }
  .table_font_bolder {
    font-weight: bold;
  }
  .table_center {
    text-align: center;
  }
}

.table-content_my {
  position: relative;
}
</style>
